package com.xinqi.modules.prepare.homework.client;

import com.xinqi.common.base.constants.ServiceNameConstants;
import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.prepare.homework.dto.req.PrepareHomeworkCreateDTO;
import com.xinqi.modules.prepare.homework.dto.req.PrepareHomeworkQueryDTO;
import com.xinqi.modules.prepare.homework.dto.req.PrepareHomeworkUpdateDTO;
import com.xinqi.modules.prepare.homework.dto.rsp.PrepareHomeworkResultDTO;
import com.xinqi.modules.prepare.homework.factory.PrepareHomeworkFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 备课区作业客户端
 *
 * @author: system
 * @date: 2023/03/19
 */
@FeignClient(value = ServiceNameConstants.XQ_PREPARE, fallbackFactory = PrepareHomeworkFallbackFactory.class)
public interface PrepareHomeworkClient {

    /**
     * 备课区作业-分页
     */
    @GetMapping("/prepare-homework/page")
    R<PageInfo<PrepareHomeworkResultDTO>> page(PrepareHomeworkQueryDTO dto);

    /**
     * 备课区作业-详情
     */
    @GetMapping("/prepare-homework/{id}")
    R<PrepareHomeworkResultDTO> findById(@PathVariable("id") Long id);

    /**
     * 新增备课区作业
     */
    @PostMapping("/prepare-homework")
    R<Long> insert(@RequestBody PrepareHomeworkCreateDTO dto);

    /**
     * 修改备课区作业
     */
    @PutMapping("/prepare-homework/{id}")
    public R<Boolean> update(@PathVariable("id") Long id, @RequestBody PrepareHomeworkUpdateDTO dto);

    /**
     * 删除备课区作业
     */
    @DeleteMapping("/prepare-homework/{id}")
    R<Boolean> delete(@PathVariable("id") Long id);

}
